Passed
Push — develop ( da967c...b45185 )
by Endre
02:46
created

Application   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 20
dl 0
loc 24
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A render 0 5 1
A componentDidMount 0 3 1
A onLanguageLoaded 0 3 1
1
import React from 'react';
2
import {ILanguageSetup} from '../Language/ChangeLanguageSetup';
3
import Container from './Container';
4
import ApplicationModel from './Model/ApplicationModel';
5
import ApplicationView from './View/ApplicationView';
6
7
interface IProperties {
8
}
9
10
interface IState {
11
  loadedLanguage: string
12
}
13
14
export default class Application extends React.Component<IProperties, IState> {
15
  constructor(props: IProperties) {
16 2
    super(props);
17
18 2
    this.state = {
19
      loadedLanguage: ''
20
    };
21
22 2
    Container.language.setupAdapter.addListener(this.onLanguageLoaded.bind(this));
23
  }
24
25
  componentDidMount(): void {
26 2
    Container.language.changeLanguageSetup.interact({languageCode: 'de-de'}, {}).then();
27
  }
28
29
  onLanguageLoaded(oldValue: ILanguageSetup, newValue: ILanguageSetup) {
30 1
    this.setState({loadedLanguage: newValue.languageCode})
31
  }
32
33
  render(): React.ReactNode {
34 3
    const model: ApplicationModel = Container.applicationPresenter.present('Application');
35
36 3
    return <ApplicationView model={model} />
37
  }
38
}